import ReactDOM from 'react-dom/client';
import AppRouter from '@router/index';
import { Provider } from 'react-redux';
import store from '@store/index';
import '@styles/base.less';
import { Toaster } from 'react-hot-toast';
import { PersistGate } from 'redux-persist/integration/react';
import { persistStore } from 'redux-persist';
import dayjs from 'dayjs';
import relativeTime from 'dayjs/plugin/relativeTime';
import 'dayjs/locale/zh-cn';

// 配置 dayjs
dayjs.locale('zh-cn');
dayjs.extend(relativeTime);

const root = ReactDOM.createRoot(
  document.getElementById('root') as HTMLElement
);
const persistor = persistStore(store);

root.render(
  <Provider store={store}>
    <PersistGate persistor={persistor}>
      <AppRouter />
    </PersistGate>
    <Toaster />
  </Provider>
);

// process : 当前进程对象 env : 环境变量对象 
// console.log('--->', process.env.REACT_APP_BASE_URL);
//console.log('--->', process.env.NODE_ENV); // yarn build -->production  /  yarn Start--> developement